/**
 * Consultation model
 */
package data.converter.model;

import java.io.IOException;
import java.io.Writer;
import java.util.LinkedHashMap;

import org.json.simple.JSONStreamAware;
import org.json.simple.JSONValue;

public class Consultation extends Product implements JSONStreamAware{
	
	private double hourlyFee;
	
	private Person consultant;
	
	public Consultation(){}
	
	public Consultation(Product product) {
		super.setName(product.getName());
		super.setProductCode(product.getProductCode());
		super.setType(product.getType());
	}

	public double getHourlyFee() {
		return hourlyFee;
	}

	public void setHourlyFee(double hourlyFee) {
		this.hourlyFee = hourlyFee;
	}

	public Person getConsultant() {
		return consultant;
	}

	public void setConsultant(Person consultant) {
		this.consultant = consultant;
	}
	
	public void writeJSONString(Writer out){
		LinkedHashMap obj = new LinkedHashMap();
		obj.put("consultant", consultant);
		obj.put("pricePerHour", hourlyFee);
		obj.put("productCode", getProductCode());
		obj.put("name", getName());
		try {
			JSONValue.writeJSONString(obj, out);
		} catch (IOException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}
}
